package com.xhl.shiro.modules.api;

import com.gitee.fastmybatis.core.PageInfo;
import com.gitee.fastmybatis.core.query.Query;
import com.xhl.shiro.base.R;
import com.xhl.shiro.modules.admin.entity.SysUserEntity;
import com.xhl.shiro.modules.admin.param.SysUserParam;
import com.xhl.shiro.modules.admin.service.SysUserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequestMapping("/api/sysUser")
public class UserController {

    @Autowired
    private SysUserService sysUserService;

    /**
     * 分页查询
     * @param param
     * @return
     */
    @GetMapping("/page")
    public R page(SysUserParam param) {
        Query query = param.toQuery();

        PageInfo<SysUserEntity> pageInfo = sysUserService.page(query);
        return R.ok().put("data", pageInfo);
    }
}
